from django.db import models

# Create your models here.
from django.db import models
from goods.models import GoodsInfo


class OrderInfo(models.Model):
    status = (
        (1, "代付款"),
        (2, "已付款"),
        (3, "已出货"),
        (4, "已收货")
    )

    order_id = models.CharField(max_length=100)  # 订单id
    order_addr = models.CharField(max_length=100)  # 收货人地址
    order_recv = models.CharField(max_length=50)  # 收货人
    order_tele = models.CharField(max_length=11)  # 联系电话
    order_fee = models.IntegerField(default=10)  # 订单运费
    order_extra = models.CharField(max_length=200)  # 订单备注
    order_status = models.IntegerField(default=1, choices=status)  # 订单的状态


class OrderGoods(models.Model):
    goods_info = models.ForeignKey(GoodsInfo, on_delete=models.CASCADE)
    goods_nums = models.IntegerField()  # 商品数量
    goods_order = models.ForeignKey(OrderInfo, on_delete=models.CASCADE)  # 商品所属订单


class CartList(models.Model):
    goods = models.ForeignKey(GoodsInfo, on_delete=models.CASCADE)  # 商品id
    goods_nums = models.IntegerField()  # 商品数量


